package com.laosg.study.base.ch4

/**
  * Created by kaimin on 8/5/2019.
  * time : 08:53
  */
object ScalaFiledOverride {
  def main(args: Array[String]): Unit = {

    val a:Aaa = new Aaa

    val b:Aaa = new Bbbb
    println("a--"+a.age+" b---"+b.age)//这里就有区别了，属性也会有动态绑定机制
  }

}

class Aaa{
  val age:Int=20
}

class Bbbb extends Aaa {

  override val age:Int=30  //看编译后的代码，都会有set/get方法

}
